from rest_framework import serializers

from .models import *


# class UserSerilalizer(serializers.Serializer):
#     name = serializers.CharField(max_length=40)
#     age = serializers.IntegerField()
#
#     def create(self, validated_data):
#         return User.objects.create(**validated_data)
#
#     def update(self, instance, validated_data):
#         instance.name = validated_data.get("name", instance.name)
#         instance.age = validated_data.get("age", instance.age)
#         instance.save()
#         return instance


# class UserSerializer(serializers.ModelSerializer):
#     class Meta:
#         model = User
#         fields = ('id', 'name', 'age')

class EmployeeSerializer(serializers.ModelSerializer):
    class Meta:
        model = Employee
        fields = ['id', 'name', 'gender', 'age',
                  'dname', 'supervisor', 'phone', 'email']
